<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*,
						org.apache.commons.logging.Log, 
						org.apache.commons.logging.LogFactory,
						com.ophelisis.common.util.*,
						com.ophelisis.common.consts.*,
						com.ophelisis.common.consts.ConstCode.MenuGNB,
						com.ophelisis.actions.system.*"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="page" uri="/tld/xdp-page.tld"%>

<script>
$(document).ready(function() {
	var upCode = $("#_prevUpCode").val();
	
	if (upCode != "") {
		pmModule.onSelectGroup(upCode);
	}
});
</script>
<!-- List Start -->
<%@ include file="/WEB-INF/jsp/common/resultMessageLocal.jsp"%>
<form id="searchForm" name="searchForm" method="post">
</form>
<div id="formtitle">
	<div id="formlist3l" class="flo_l">
		<form id="groupForm" name="groupForm" method="post">
			<input type="hidden" id="isNew" name="isNew" value="Y" />
			<input type="hidden" id="codeGroupId" name="codeGroupId" value="" />
			<table class="liststyle1">
				<colgroup>
					<col width="" />
				</colgroup>
				<tr>
					<th scope="col">그룹</th>
				</tr>
			</table>
			<ul id="rGroup">
				<li class="ulPlusMenu"><a href="#" class="clickable" onclick="javascript:pmModule.setAddGroup();">그룹 추가</a></li>
				 <c:choose>
					<c:when test="${codeGroupList != '' && !empty codeGroupList}">
						<c:forEach var="cgList" items="${codeGroupList}" varStatus="status">
							<li class="ulMenu <c:if test="${cgList.codeGroupId == _prevUpCode}">selected</c:if>" id="group_${cgList.codeGroupId}">
								<c:if test="${cgList.useYn == 'N'}">
									<div class="flo_l"><img src="images/icon/icon_02.gif" style="padding-top:2px;" />&nbsp;</div>
								</c:if>
								<div class="flo_l"><a href="#" class="clickable" onclick="javascript:pmModule.setModifyGroup('${cgList.codeGroupId}','${cgList.codeGroupNm}','${cgList.codeGroupDesc}','${cgList.useYn}');">${cgList.codeGroupNm}</a></div>
								<div class="flo_r">
									<c:if test="${cgList.codeGroupId != '1'}"><img src="images/btn/btn_delete.gif" class="clickable" onclick="javascript:pmModule.setDeleteGroup('${cgList.codeGroupId}');" /></c:if>
									<img src="images/btn/btn_select02.gif" class="clickable" onclick="javascript:pmModule.onSelectGroup('${cgList.codeGroupId}');" />
								</div>
							</li>
							<input type="hidden" id="use_${cgList.codeGroupId}" name="use_${cgList.codeGroupId}" value="${cgList.useYn}" />
						</c:forEach>
					</c:when>
					<c:otherwise>
						<li class="ulMenu"></li>
					</c:otherwise>
				</c:choose>
			</ul>
			<ul id="addGroupDiv" class="bgWhite nodisplay">
				<li class="ulFormMenu">그룹 이름 : <input type="text" id="codeGroupNm" name="codeGroupNm" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">그룹 설명 : <input type="text" id="codeGroupDesc" name="codeGroupDesc" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">사용 여부 : <input type="radio" id="useYn1" name="useYn" value="Y" checked="checked" /> 사용 <input type="radio" id="useYn2" name="useYn" value="N" /> 미사용</li>
				<li class="ulFormMenu tex_center">
					<img src="images/btn/btn_cancel.gif" class="clickable" onclick="javascript:pmModule.cancelGroup();" />&nbsp;
					<img src="images/btn/btn_save.gif" class="clickable" onclick="javascript:pmModule.saveGroup();" />
				</li>
			</ul>
		</form>
	</div>
	<div id="formlist3r" class="flo_l">
		<form id="codeForm" name="codeForm" method="post">
			<input type="hidden" id="isNew" name="isNew" value="Y" />
			<input type="hidden" id="codeGroupId" name="codeGroupId" value="" />
			<input type="hidden" id="codeId" name="codeId" value="" />
			<table class="liststyle1">
				<colgroup>
					<col width="" />
				</colgroup>
				<tr>
					<th scope="col">코드</th>
				</tr>
			</table>
			<ul id="rMenu" class="nodisplay">
				<li class="ulPlusMenu"><a href="#" class="clickable" onclick="javascript:pmModule.setAddCode();">코드 추가</a></li>
				 <c:choose>
					<c:when test="${codeList != '' && !empty codeList}">
						<c:forEach var="cList" items="${codeList}" varStatus="status">
							<li class="ulMenu group_${cList.codeGroupId} nodisplay <c:if test="${cList.codeId == _prevCode}">selected</c:if>" id="code_${cList.codeId}">
								<c:if test="${cList.useYn == 'N'}">
									<div class="flo_l"><img src="images/icon/icon_02.gif" style="padding-top:2px;" />&nbsp;</div>
								</c:if>
								<div class="flo_l"><a href="#" class="clickable" onclick="javascript:pmModule.setModifyCode('${cList.codeId}','${cList.codeNm}','${cList.codeValue}','${cList.codeDesc}','${cList.codeType}','${cList.codeLink}','${cList.useYn}');">${cList.codeNm}</a></div>
								<div class="flo_r">
									<img src="images/btn/btn_delete.gif" class="clickable" onclick="javascript:pmModule.setDeleteCode('${cList.codeId}');" />
								</div>
							</li>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<li class="ulMenu"></li>
					</c:otherwise>
				</c:choose>
			</ul>
			<ul id="addCodeDiv" class="bgWhite nodisplay">
				<li class="ulFormMenu">코드 이름 : <input type="text" id="codeNm" name="codeNm" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">코드 값&nbsp;&nbsp;&nbsp; : <input type="text" id="codeValue" name="codeValue" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">코드 설명 : <input type="text" id="codeDesc" name="codeDesc" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">코드 유형 : 
					<select id="codeType" name="codeType" onchange="javascript:pmModule.onSelectCodeType(this);">
						<option value="">== 유형 선택 ==</option>
						<option value="0">일반</option>
						<option value="1">링크</option>
					</select>
				</li>
				<li class="ulFormMenu">코드 링크 : <input type="text" id="codeLink" name="codeLink" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">사용 여부 : <input type="radio" id="useYn1" name="useYn" value="Y" checked="checked" /> 사용 <input type="radio" id="useYn2" name="useYn" value="N" /> 미사용</li>
				<li class="ulFormMenu tex_center">
					<img src="images/btn/btn_cancel.gif" class="clickable" onclick="javascript:pmModule.cancelCode();" />&nbsp;
					<img src="images/btn/btn_save.gif" class="clickable" onclick="javascript:pmModule.saveCode();" />
				</li>
			</ul>
		</form>
	</div>
</div>
<!-- List End -->
